﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SchEdu.Framework.DataModel;

namespace SchEduApp
{
    public partial class EnvironmentForm : Form
    {

        DataGridHelper dataGridHelper = new DataGridHelper();


        public EnvironmentForm()
        {
            InitializeComponent();
            this.workCenterBindingSource.DataSource = SchEduAppContext.SchEduData.SchEduDataSet;
        }

        private void workCenterGridView_CellValidated(object sender, DataGridViewCellEventArgs e)
        {
            dataGridHelper.ResetError(sender, e);
        }

        private void workCenterGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            dataGridHelper.Validate(sender, e);
        }

        private void workCenterGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            workCenterStatusStrip.Text = "Invalid Work Center:" + e.Exception.Message;
        }


        private void resourceGridView_CellValidated(object sender, DataGridViewCellEventArgs e)
        {
            dataGridHelper.ResetError(sender, e);
        }

        private void resourceGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            dataGridHelper.Validate(sender, e);
        }

        private void resourceGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            machineStatusStrip.Text = "Invalid Machine:" + e.Exception.Message;
        }

    }
}
